home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_093 / microemacs / doc / cmacros < prev    next >
Text File  |  1992-05-06  |  3KB  |  97 lines

  1. ;   Cmacros!
  2. ;
  3. ;   Here are a couple handy macros for MircoEMACS 38i. You can add these to 
  4. ;   your startup file ".emacsrc" or simply "execute-file" this macro file. It
  5. ;   attaches two macro programs to F9 and F10. Pressing F9 causes the source
  6. ;   in the current buffer to be compiled. ( based on buffer file name )
  7. ;   On errors a jump is made to the source line(s) with the error message(s)
  8. ;   shown as the top line of the screen. 
  9. ;   The output of the compile is sent to a error file "error.dat"...If there
  10. ;   are any errors after the compile you will be automatically positioned at the
  11. ;   error line with the corresponding error message displayed at the top of the
  12. ;   screen. Pressing F10 causes you to proceed to the next error.
  13. ;
  14. ; Compile and error check
  15. ;
  16. ; This macro will compile the source file in the current buffer. Then it
  17. ;   will call the error handling macro which looks for a magic file
  18. ;   named "error.dat"...The error handling macro takes it from there...
  19. ;   
  20. ;   This macro is bound to the F9 function key.
  21. ;
  22. bind-to-key execute-macro-9 FN8
  23. 9   store-macro
  24.     delete-other-windows
  25.     delete-buffer "error.dat"
  26.     set %command "CC "
  27.     set %command &cat %command ">error.dat "
  28.     set %command &cat %command $cfname
  29.     shell-command %command
  30.     execute-macro-8
  31. !endm
  32. ; Error handling macro.
  33. ;
  34. ;   This macro is smart in knowing the format of Aztec C's error messages.
  35. ; It will automagically look for a file named "error.dat" in the current
  36. ; directory. If found it will find the first error message and the file
  37. ; it belongs to. It then reads the file in and jumps to the first known
  38. ; error line. All this macro needs is a file in the current directory
  39. ; named "error.dat" to function. ( assuming "error.dat" is the redirected
  40. ; output from the Aztec C compiler. ) This macro can be called repeatly to
  41. ; process every error line in "error.dat"
  42. ;   
  43. ;               This macro is bound to the F10 function key.
  44. ;
  45. bind-to-key execute-macro-8 FN9
  46. 8   store-macro
  47.     delete-other-windows
  48.     split-current-window
  49.     1 next-window
  50.     9 shrink-window
  51.     !force find-file "error.dat"
  52.     !if &sequal $status "FALSE"
  53.         write-message "Error file not found."
  54.         !return
  55.     !endif
  56.     beginning-of-line
  57.     next-line
  58.     !force search-forward ":"
  59.     !if &sequal $status "FALSE"
  60.         write-message "No more errors found."
  61.         next-window
  62.         delete-other-windows
  63.         !return
  64.     !endif                
  65.     beginning-of-line
  66.     set %file &chr $curchar
  67. *fileget
  68.     forward-character
  69.     !if &equal $curchar 58
  70.         !goto filehave
  71.     !endif
  72.     set %file &cat %file &chr $curchar
  73.     !goto fileget
  74. *filehave   
  75.     search-forward ":"
  76.     set %line &chr $curchar
  77. *lineget
  78.     forward-character
  79.     !if &equal $curchar 58
  80.         !goto linegot
  81.     !endif
  82.     set %line &cat %line &chr $curchar
  83.     !goto lineget
  84. *linegot
  85.     next-window
  86.     !force find-file %file
  87.     !if &sequal $status "FALSE"
  88.         write-message "Source file not found."
  89.         !return
  90.     !endif
  91.     goto-line %line
  92. !endm
  93. ; EOF
  94. ;
  95.